import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {TabsPage} from './tabs.page';
import {GuestGuard} from "../guard/guest.guard";

const routes: Routes = [
  {
    path: '',
    component: TabsPage,
    children: [
      {
        path: 'help',
        loadChildren: () => import('../page/help/help.module').then(m => m.HelpPageModule),
      },
      {
        path: 'ask',
        loadChildren: () => import('../page/ask/ask.module').then(m => m.AskPageModule),
      },
      {
        path: 'announce',
        loadChildren: () => import('../page/announce/announce.module').then(m => m.AnnouncePageModule),
        canActivate: [GuestGuard]
      },
      {
        path: 'info',
        loadChildren: () => import('../page/info/info.module').then(m => m.InfoPageModule),
        canActivate: [GuestGuard]
      },
      {
        path: '',
        redirectTo: '/ynuer/help',
        pathMatch: 'full'
      }
    ]
  },
  {
    path: '',
    redirectTo: '/ynuer/ask',
    pathMatch: 'full'
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
})
export class TabsPageRoutingModule {
}
